package fashionshop.bll;

import java.sql.ResultSet;

import fashionshop.dal.CategoryDAL;
import fashionshop.dal.LevelDAL;


public class LevelBLL {

	private int id;
	private String name;
	private int discountPercent;
	private int score;
	
	public LevelBLL() {
		this.name = "";
		this.discountPercent = 0;
		this.score = 0;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getDiscountPercent() {
		return discountPercent;
	}

	public void setDiscountPercent(int discountPercent) {
		this.discountPercent = discountPercent;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	
	public static ResultSet LoadAllLevel() throws Exception {
		return LevelDAL.LoadAll();
	}
	
	public static int getIdFromName(String name) throws Exception {
		ResultSet result = LevelDAL.LoadIDByName(name);
		int id = 0;
		while (result.next()){
			id = result.getInt("ID");
		}
		return id;
	}
}
